package net.apexes.demo.codegen.ormlite.column;

import net.apexes.commons.ormlite.Column;
import net.apexes.commons.ormlite.Index;
import net.apexes.demo.codegen.ormlite.column.base.QEntityBase;
import net.apexes.demo.codegen.ormlite.entity.Brand;

/**
 * QBrand is a ORMLite query type for Brand
 * @see Brand
 */
public class QBrand extends QEntityBase<Brand> {

    public static final QBrand $ = new QBrand("BRAND");

    public final Column sn = field("sn").columnName("SN").varchar(16).notNull().build();

    public final Column name = field("name").columnName("NAME").varchar(32).notNull().build();

    public class Indexs {

        public final Index constraintIndex3 = index("CONSTRAINT_INDEX_3").unique().column(sn).build();

        public final Index primaryKey3 = index("PRIMARY_KEY_3").unique().column(id).build();

    }

    public final Indexs ix = new Indexs();

    public QBrand(String tableName) {
        super(Brand.class, tableName);
    }

    @Override
    public Brand newInstance() {
        return new Brand();
    }

    @Override
    public Object getFieldValue(Brand instance, String fieldName) {
        switch (fieldName) {
            case "sn":
                return instance.getSn();
            case "name":
                return instance.getName();
            default:
                return super.getFieldValue(instance, fieldName);
        }
    }

    @Override
    public void setupFieldValue(Brand instance, String fieldName, Object value) {
        switch (fieldName) {
            case "sn":
                instance.setSn((java.lang.String) value);
                break;
            case "name":
                instance.setName((java.lang.String) value);
                break;
            default:
                super.setupFieldValue(instance, fieldName, value);
                break;
        }
    }

}

